// ShekelFunction.h: interface for the ShekelFunction class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(SHEKEL_FUNCTION_H)
#define SHEKEL_FUNCTION_H


#include "Function.h"


#include <iostream>
#include <vector>
using namespace std;


#include "Time.h" // to check time of cal a set of calculated intensities
                 // relative to additional overhead of cal derivatives
                 // for the purpose of first publication of HMC


class ShekelFunction : public Function  
{
public:
	ShekelFunction(int i_NInput);
	virtual ~ShekelFunction();

	double Value(double *Input);
  double Value(vector<double> &Input);
  double NormValue(double *Input){return 1.0;}
  double NormValue(vector<double> &Input){return 1.0;}

	void BuildDerivative(double *Input, double *Derivative);

  double distanceFromGlobalMinimum(double *solution);

	void print_sol(double *Input, double ChiSq, char name[]);
  void print_sol(char filename[]);

	
	void createRandomSol(double *testInput)
	{
	  int m;

		for(m=1;m<=NInput;m++)	  
    {
		  testInput[m] = (10.0*ran1());
    }
	}

  void customModifySol(double *TestInput, int i) {}

  void test_function();



private:
  void checkBoundary(vector<double> &Input);
  void checkBoundary(double *Input);

	//Position   *XDerivative;
  double **c;
  double *b;
  double *dDerivative;
  double *mDerivative;

  double *danswer; // used in method value()
  double **dDeriv; // used in method buildDerivative()

  vector<double> knownMin; // used in DistanceFromGlobalMinimum()

	Time timer; // to measure time for first HMC publication
};

#endif // !defined(SHEKEL_FUNCTION_H)
